//...
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <iostream>
#include <list>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;

bool p[201][201];
int w, h, n, i, j, k, a, b, c, d, sum;
vector<int> v;

int main (){
	//freopen("in.txt", "r", stdin);//freopen("out.txt", "w", stdout);
	scanf("%d%d%d", &w, &h, &n);
	memset(p,1,sizeof(p));
	w+=w;
	h+=h;
	for(i=0;i<=w;++i)p[h][i]=p[0][i]=0;
	for(i=0;i<=h;++i)p[i][w]=p[i][0]=0;
	
	for(k=0;k<n;++k){
		scanf("%d%d%d%d", &a,&b,&c,&d);
		a+=a;b+=b;c+=c;d+=d;
		for(i=a;i<=c;++i)
		for(j=b;j<=d;++j)p[j][i]=0;
	}
	for(a=1;a<h;a+=2){
		for(b=1;b<w;b+=2){
			if(p[a][b]){
				sum=0;
				for(i=a;p[i][b];++i){
					for(j=b;p[i][j];++j){
						if((i&1)&&(j&1)){
							p[i][j]=0;
							++sum;
						}
					}
				}
				v.push_back(sum);
			}
		}
	}
	// for(i=0;i<=h;++i){
		// for(j=0;j<=w;++j)printf("%d", p[i][j]);
		// printf("\n");
	// }
	sort(v.begin(),v.end());
	n=v.size();
	printf("%d", v[0]);
	for(i=1;i<n;++i)printf(" %d", v[i]);
	return 0;
}
